<template>
	<view
		:style="'order:'+item.order+';'+item.css"
		class="box-swiper-list-user-1">
		<scroll-view scroll-x>
			<view
				v-for="item in list"
				class="_for"
				@click="$_to('user/detail?uid=' + item.uid)">
				<view
					class="_for-avatar"
					:style="item.nicknameColor?'border: 8rpx solid '+item.nicknameColor+';':''">
					<global-lazy-load-image
						:image="item.avatar"
						width="120rpx"
						height="120rpx"
						borderRadius="0"></global-lazy-load-image>
				</view>
				<view
					class="_for-role-name"
					:style="item.nicknameColor?'background:'+item.nicknameColor+';color:#FFF;':''">{{item.roleName}}</view>
				<view class="_for-nickname">{{item.nickname}}</view>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	export default {
		name:"box-swiper-list-user-1",
		props:{
			item:{
				type:Object,
				default:null
			}
		},
		data() {
			return {
				list:[],
				listStatus:"loading"
			};
		},
		mounted(){
			this.getList();
		},
		methods: {
			getList(){
				this.$_request(
					"GET", "/api/fresns/v1/user/list",
					{
						...this.item.query,
						"filterType":"whitelist",
						"filterKeys":"uid,avatar,nicknameColor,roleName,nickname",
						"page":1
					},
					(res) => {
						if (res.data.data.list.length) {
							this.list = res.data.data.list;
							this.listStatus = "success";
						} else {
							this.listStatus = "empty";
						}
					}
				)
			},
		}
	}
</script>

<style lang="scss" scoped>
.box-swiper-list-user-1{
	background: #FFF;
	padding: 25rpx;
	scroll-view{
		white-space: nowrap;
		._for{
			display: inline-flex;
			align-items: center;
			justify-content: center;
			flex-flow: column;
			margin: 0 25rpx 0 0;
			._for-avatar{
				width: 120rpx;
				height: 120rpx;
				overflow: hidden;
				border-radius: 100rpx;
				border: 8rpx solid $border;
			}
			._for-role-name{
				display: flex;
				align-items: center;
				justify-content: center;
				font-size: 18rpx;
				line-height: 18rpx;
				background: $border;
				padding: 5rpx 8rpx 3rpx 8rpx;
				margin-top: -15rpx;
				position: relative;
				z-index: 2;
				border-radius: 2rpx;
			}
			._for-nickname{
				font-size: 28rpx;
				line-height: 28rpx;
				margin-top: 15rpx;
			}
		}
	}
}
</style>